{% set pypi_name = 'murano-pkg-check' %}
{% set upstream_version = upstream_version('0.3.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Murano package validator tool
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/murano/latest/
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('PyYAML') }}
BuildRequires:  {{ py3('oslo.i18n') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('python-subunit') }}
BuildRequires:  {{ py3('semantic_version') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('stevedore') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildRequires:  {{ py3('yaql') }}
BuildArch:      noarch

%description
Murano package validator tool

%package -n {{ py2name(py_versions='py3') }}
Summary:        Murano package validator tool
Requires:       {{ py3('PyYAML') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('semantic_version') }}
Requires:       {{ py3('six') }}
Requires:       {{ py3('stevedore') }}
Requires:       {{ py3('yaql') }}
%if 0%{?suse_version}
Obsoletes:      {{ py2name(py_versions='py2') }} < 0.3.1
%endif

%description -n {{ py2name(py_versions='py3') }}
Murano package validator tool

%prep
%autosetup -n {{ pypi_name }}-%{version}
%py_req_cleanup

%build
%{py3_build}

%install
%{py3_install}

%check
%{__python3} -m stestr.cli --test-path=./muranopkgcheck/tests/ \
  run \
  --black-regex=muranopkgcheck.tests.test_manager.ManagerTest.test_validate

%files -n {{ py2name(py_versions='py3') }}
%doc README.rst
%license LICENSE
%{_bindir}/murano-pkg-check
%{python3_sitelib}/muranopkgcheck
%{python3_sitelib}/*.egg-info

%changelog
